package cn.chenchendemospringboot.stock_demo.service.Impl;

import cn.chenchendemospringboot.stock_demo.entity.Inventory;
import cn.chenchendemospringboot.stock_demo.entity.KafkaEventProcess;
import cn.chenchendemospringboot.stock_demo.mapper.InventoryMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class InventoryService extends ServiceImpl<InventoryMapper, Inventory> {

    public boolean saveInventory(Inventory inventory) {
//        int i= 1/0;
        return save(inventory);
    }
    /**
     * 批量保存 inventoryList 实体
     * @param inventoryList 要保存的实体列表
     * @return 是否全部保存成功
     */
    public boolean saveBatch(List<Inventory> inventoryList) {
        // 默认批次大小为 1000，可以根据实际情况调整
        return this.saveBatch(inventoryList, 1000);
    }
}
